package chain

type tSimpleLogger struct {
	chain ILoggerFilter
}


func NewSimpleLogger() ILogger {
	vErrorLogger := newLoggerFilter(newFileWriter("error.log"), LEVEL_ERROR, nil)
	vInfoLogger := newLoggerFilter(newFileWriter("info.log"), LEVEL_INFO, nil)
	vDebugLogger := newLoggerFilter(newFileWriter("debug.log"), LEVEL_DEBUG, nil)

	vDebugLogger.Next(vInfoLogger)
	vInfoLogger.Next(vErrorLogger)

	return &tSimpleLogger {
		vDebugLogger,
	}
}

func (me *tSimpleLogger) Debug(msg string) {
	me.chain.Handle(LEVEL_DEBUG, msg)
}

func (me *tSimpleLogger) Info(msg string) {
	me.chain.Handle(LEVEL_INFO, msg)
}

func (me *tSimpleLogger) Error(msg string) {
	me.chain.Handle(LEVEL_ERROR, msg)
}